//
//  NSString+AttributedString.m
//  YGMobile
//
//  Created by 袁斌 on 2017/2/4.
//  Copyright © 2017年 Elephants Financial Service. All rights reserved.
//

#import "NSString+AttributedString.h"

@implementation NSString (AttributedString)

- (NSAttributedString *)attributedStringWithRangeString:(NSString *)rangeStr
                                             attributes:(NSDictionary<NSString *,id> *)attributes
{
    NSString *totalStr = [self copy];
    
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]
                                                   initWithString:totalStr];
    [attributedString addAttributes:attributes range:[totalStr rangeOfString:rangeStr]];
    
    return attributedString;
}

@end
